<template>
    <div class="apppadding bgfff">
        <bDetail :instance="pForm" class="form" title="预约人信息" cover="80%"></bDetail>
    </div>
    <div class="apppadding bgfff">
        <bDetail :instance="pForm" label_prop="labels_info" class="form" title="订单信息" cover="80%"></bDetail>
    </div>
    <div class="blank"></div>
    <div v-if="pForm.data.status === NURSING_APPOINTMENT_STATUS.已分配">
        <Button type="primary" :plain="true" v-if="but.has('nursing_appointment:accept:no')" @click="assignNo">
            {{ but.get('nursing_appointment:accept:no') || '退回' }}</Button>
        <Button type="primary" v-if="but.has('nursing_appointment:accept')" @click="() => pForm.accept()">
            {{ but.get('nursing_appointment:accept') || '接受' }}</Button>
    </div>
</template>

<script lang="ts" setup>
import bDetail from "@m/components/public/b_detail.vue";
import { IForm } from "@b/index/nursing_appointment";
import { useRoute } from "vue-router";
import { pagebuttonStore } from "@b/store";
import { Button } from "vant";
import bMessageBox from "@b/srcm/components/widget/b_message_box";
import { NURSING_APPOINTMENT_STATUS } from "@b/model/enum";

const pForm = new IForm();
const id = useRoute().query.id;
pForm.id = Number(id);
const but = pagebuttonStore().button;
pForm.url.info = '/nursing_appointment/info/nurse';
pForm.setData();
pForm.init();

const assignNo = () => {
    bMessageBox('拒绝原因', {
        title: '退回',
        placeholder: '请输入退回原因',
        confirmButtonText: '确定',
        cancelButtonText: '取消',
    }).then((message) => {
        pForm.reject(message)
    })
}
</script>
